<template>
  <div>
    父组件
    <hr />
    <!-- 规律：除了字符串，其它统统要绑定 -->
    <!-- <Child
      name="秋雨"
      :age="18"
      :isMan="true"
      :address="address"
      :hobby="hobby"
      style="color: red; font-size: 30px"
    /> -->

    <Child
      name="秋雨"
      :age="age"
      :isMan="true"
      :address="address"
      :hobby="hobby"
      @myevent="getValue"
    />
  </div>
</template>

<script>
import Child from './Child.vue'
// Vue2中每个组件都有组件实例，该实例只为当前组件服务
export default {
  components: {
    Child
  },
  data () {
    return {
      age: 18,
      address: {
        province: '吉林省',
        city: '长春市'
      },
      hobby: ['唱歌', '跳舞', 'rap']
    }
  },
  methods: {
    getValue (value) {
      console.log('---parent---', value)
    }
  }
}
</script>
